<template>
  <div>
    <h2>注册账号</h2>
    <input type="text" v-model.lazy="uname"/>
    <span>{{msg}}</span>
  </div>
</template>

<script>
// 导入 import axios from 'axios' 
import axios from 'axios' 
export default {
data(){
  return{
    uname:'',
    msg:''
  }
},
watch:{
   async uname(newVal){
    // console.log(newVal);
    if(newVal === '') {
      this.msg = ''
      return
    }
   const{data:res} = await axios.get('http://www.itcbc.com:3006/api/finduser/' + newVal)
  //  console.log(res);
  this.msg = res.message

  }
}
}
</script>

<style>

</style>